﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraBars;
using DevExpress.XtraGrid.Views.Grid.ViewInfo;
using DevExpress.XtraGrid.Views.Grid;
using DevExpress.XtraGrid;

namespace CRM_SMS_MARKETING
{
    public partial class RibbonForm1 : DevExpress.XtraBars.Ribbon.RibbonForm
    {
        public RibbonForm1()
        {
            InitializeComponent();
        }

        private void gridView2_DragObjectDrop(object sender, DevExpress.XtraGrid.Views.Base.DragObjectDropEventArgs e)
        {
            var obj = e.DragObject;
        }
        private void simpleButton1_Click(object sender, EventArgs e)
        {

        }
        private void RibbonForm1_Load(object sender, EventArgs e)
        {
            DataTable t1 = new DataTable();
            t1.Columns.Add(new DataColumn("id", typeof(int)));
            t1.Columns.Add(new DataColumn("name", typeof(string)));
            gridControl2.DataSource = t1;
            gridControl1.DataSource = t1.Copy();
        }

        private void simpleButton1_Click_1(object sender, EventArgs e)
        {
            RibbonForm2 f = new RibbonForm2();
            f.Show();
        }

        private void gridView1_DragObjectStart(object sender, DevExpress.XtraGrid.Views.Base.DragObjectStartEventArgs e)
        {

        }

        private void gridControl2_MouseDown(object sender, MouseEventArgs e)
        {

        }
        GridHitInfo downHitInfo = null;

       
    

        private void gridControl2_DragOver(object sender, DragEventArgs e)
        {


            if (e.Data.GetDataPresent(typeof(DataRow)))

                e.Effect = DragDropEffects.Move;

            else

                e.Effect = DragDropEffects.None;

        }

        private void gridControl2_DragDrop(object sender, DragEventArgs e)
        {
            GridControl grid = sender as GridControl;

            DataTable table = grid.DataSource as DataTable;

            DataRow row = e.Data.GetData(typeof(DataRow)) as DataRow;

            if (row != null && table != null && row.Table != table)
            {

                table.ImportRow(row);

                row.Delete();

            }
        }
    }
}